package com.share.util;

import javax.sql.DataSource;

import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

public class DynamicDataSource extends AbstractRoutingDataSource{

	/* 
	 * 确定最终的数据源
	 */
	@Override
	protected Object determineCurrentLookupKey() {
//		DynamicDataSourceHolder.setDataSourceType(null);
		return DynamicDataSourceHolder.getDataSourceType();
//		return null;
	}
	
	public DataSource getCurrentDataSources() {
		return determineTargetDataSource();
	}

}
